package example.multi.xa.service;

import blingking.jfinal.orm.annotation.JFinalORMTx;
import blingking.jfinal.orm.tx.TxTypeEnum;
import example.multi.xa.model.TorderSecond;
import example.multi.xa.model.Torder;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Service
public class OrderService {

    @JFinalORMTx(txType = TxTypeEnum.XA)
    public boolean addOrder(){
        Torder torder = new Torder();
        torder.setGoodsId(2);
        torder.setOrderNum("222222");
        torder.setAmount(new BigDecimal("222"));
        torder.save();

        TorderSecond torder2 = new TorderSecond();
        torder2.setGoodsId(2);
        torder2.setOrderNum("222222");
        torder2.setAmount(new BigDecimal("222"));
        boolean bool = torder2.save();
        return bool;
    }
}
